package com.controller;

import com.entity.City;
import com.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class CityController {
    @Autowired
    private CityService cityService;
    @RequestMapping("/selectAll")
//    将map转换成json串
    @ResponseBody
    public Map selectAll(Integer offset,Integer limit){
        Map map=cityService.selectAll(offset,limit);
        return map;
    }
    @RequestMapping("/selectOne")
    @ResponseBody
    public City selectOne(Integer cityId){
        return cityService.selectOne(cityId);
    }
    @RequestMapping("/update")
    @ResponseBody
    public Map update(City city){
        return cityService.update(city);
    }
//    public String insert(City city){
//        cityService.insert(city);
//        return "success";
//    }
}
